<?php
/**
 *	User Views.
 *	@package		mv2.view.administration
 *	@author			Christian Würker <Christian.Wuerker@CeuS-Media.de>
 *	@since			29.08.2007
 *	@version		0.1
 */
/**
 *	User Views.
 *	@package		mv2.view.administration
 *	@extends		CMF_Krypton_Core_DefinitionView
 *	@uses			CMF_Krypton_View_Component_List
 *	@uses			Logic_User
 *	@uses			Logic_Role
 *	@uses			Collection_User
 *	@author			Christian Würker <Christian.Wuerker@CeuS-Media.de>
 *	@since			29.08.2007
 *	@version		0.1
 */
class View_Administration_User extends CMF_Krypton_Core_DefinitionView
{
	/**
	 *	Builds Views.
	 *	@access		public
	 *	@return		string
	 */
	public function buildContent()
	{
		$request	= $this->registry->get( 'request' );
		$auth		= $this->registry->get( 'auth' );
		$content	= "";
		if( $request->has( 'add' ) )
		{
			$view		= new View_Administration_User_Add();
			$content	= $view->buildContent();
#			$content	.= $this->buildContentRoles( 'add' );
		}
		else if( $request->has( 'userId' ) )
		{
			$view		= new View_Administration_User_Edit();
			$content	.= $view->buildContent();
			$view		= new View_Administration_User_Status();
			$content	.= $view->buildContent();
			$view		= new View_Administration_User_Roles();
			$content	.= $view->buildContent();
			$view		= new View_Administration_User_Pages();
			$content	.= $view->buildContent();
		}
		else
		{
			$view		= new View_Administration_User_Filter();
			$content	.= $view->buildContent();
			$view		= new View_Administration_User_List();
			$content	.= $view->buildContent();
		}
		return $content;
	}

	/**
	 *	Builds Extra Panel.
	 *	@access		public
	 *	@return		string
	 */
	public function buildExtra()
	{
//		return $this->loadContent( 'purchase.market.car.extra.html' );
	}

	protected function getStatusIcon( $status )
	{
		$config		= $this->registry->get( 'config' );
		$words		= $this->words['user']['user_states'];
		$path		= $config['paths.icons']."famfamfam/silk/";
		switch( $status )
		{
			case -2:	$icon	= "bin_closed";
						break;
			case -1:	$icon	= "lock";
						break;
			case 0:		$icon	= "star";
						break;
			case 1:		$icon	= "accept";
						break;
		}
		$image	= $this->html->Image( $path.$icon.".png", $words[$status] );
		return "<span style='float: left; display: block; margin-right: 4px'>".$image."</span>";
	}
}
?>
